<?php
/**
 * Created by PhpStorm.
 * User: zhangxilu
 * Date: 2017/12/27
 * Time: 下午11:29
 */

namespace common\logic;


use common\models\CounterDataModel;
use backend\models\CounterFormModel;
use yii\db\ActiveQuery;
use yii\helpers\ArrayHelper;

class CounterLogic extends Logic
{

    /**
     * @return ActiveQuery
     */
    protected function _getActiveQuery()
    {
        return CounterDataModel::find();
    }


    public function getSiteCounter(){
        $model =$this->_getActiveQuery()->one();
        if(empty($model)){
            return '数据不存在';
        }

        $result = ['total_save'=>$model["total_save"],'total_user'=>$model["total_user"]];

        return $result;
    }
}